global var, fn, MarkedCard, menu1, menu2, TextArrowStatus
if the version < 1.2 then
answer "This stack needs HyperCard version 1.2."
doMenu "Quit HyperCard"
end if
set cursor to 4
set userlevel to 5
hide msg
set blindTyping to true
set textArrows to false
put "off" into TextArrowStatus
put NewMenu("Articles","About Ref Tracker.../?", "(-","Find Again/A","Store This Article/S", "Go to Stored Article/G", "(-","To Clipboard/K", "(-","To Disk/D","Close Disk File", "(-","Read In Articles/I","Write Out Articles/W") into menu1
put NewMenu("Operations","Clear Special Clipboard", "Write Clipboard To Disk","Text Arrows/5","(-", "Delete This Card/L","Make A New Card/Y", "(-","Sort The Stack/J","Compact The Stack/U", "Eliminate Duplicates/E") into menu2
global toBeFound
if toBeFound is empty then EnableMenu 1, 3, false
EnableMenu 1, 10, false
EnableMenu 2, 2, false
global screenSize
put item 2 of the screenRect into screenTop
if top of card window > screenTop + 20 then
put "big" into screenSize
titleBar hide
put empty into tempFieldScript
set loc of msg to 22,366
else
put "small" into screenSize
hide menuBar
put "on mouseEnter" & return into tempFieldScript
put "show menuBar" & return after tempFieldScript
put "end mouseEnter" & return & return after tempFieldScript
put "on mouseLeave" & return after tempFieldScript
put "hide menuBar" & return after tempFieldScript
put "end mouseLeave" & return after tempFieldScript
set loc of msg to 22,300
end if
set lockScreen to true
set the script of bkgnd field id 85 of cd 2 to tempFieldScript
set the name of bkgnd button id 79 of cd 2 to "Author"
set hilite of bkgnd button id 88 of cd 2 to false
put empty into cd field "HoldingArea" of cd "Help Card"
set lockScreen to false
put "" into var
put "" into fn
put the number of cds of bkgnd id 30235 into cd field "number of cards" of cd "Help Card"
put cd field id 16 of cd "Help Card" into MarkedCard
end openStack
on openCard
global tempThing, exempt
hide msg
if the short name of this cd is "Help Card" or the short name of this cd is "TitleCard" or exempt is "Yes" then
put "No" into exempt
exit openCard
end if
put tempThing into bkgnd field id 80
end openCard
on closeCard
global PriorCard, tempThing
put the short name of this cd into PriorCard
screenCheck
if the short name of this cd is "Help Card" or the short name of this cd is "TitleCard" then
exit closeCard
end if
put bkgnd field "Thing" into tempThing
put empty into bkgnd field id 80
end closeCard
on closeStack
set cursor to 4
put the number of cds of background id 30235 into cd field "number of cards" of cd "Help Card"
answer "Reference Tracker Version 1.6" & return & " January 1st, 1990" & return & " © 1990 by Ian Neath" & return & " From Owl Software" with "Help" or "Ok"
if it is "Help" then
send mouseUp to bkgnd button id 41
end if
end AboutRefTracker
on adjustTextArrows
global TextArrowStatus
if TextArrowStatus is "on" then
set cursor to TAoff
put "off" into TextArrowStatus
set textArrows to false
CheckMenu 2, 3, false
wait 1 sec
else
set cursor to TAon
put "on" into TextArrowStatus
set textArrows to true
CheckMenu 2, 3, true
wait 1 sec
end if
end adjustTextArrows
on arrowKey whichKey
global TextArrowStatus
if TextArrowStatus is "on" then
pass arrowKey
else
if whichKey is "up" and the optionKey is down then
set cursor to signal
global MarkedCard
put the name of this cd into MarkedCard
put MarkedCard into cd field id 16 of cd "Help Card"
wait 1 second
else if whichKey is "up" and the optionKey is not down then
set cursor to signal
global MarkedCard
visual effect dissolve
go to MarkedCard
else if whichKey is "down" then
set cursor to signal
global PriorCard
if PriorCard is empty or the name of this cd is "Help Card" or PriorCard is "Help Card" then
exit arrowKey
else
visual effect dissolve
go to PriorCard
end if
else if whichKey is "right" then
go next cd of this bkgnd
else if whichKey is "left" then
go prev cd of this bkgnd
end if
end if
end arrowKey
on clearClip
set cursor to 4
global CommIn
put empty into CommIn
put empty into cd field "HoldingArea" of cd "Help Card"
EnableMenu 2, 2, false
end clearClip
on closeDiskFile
global fn, var,CommIn
if fn is empty then
exit closeDiskFile
end if
answer return & "Close file " & quote & fn & quote & " ?" with "No" or "Yes"
if it is "Yes" then
put fn into tempfn
put "" into fn
put "" into var
put "" into CommIn
close file tempfn
answer "File" && quote & tempfn & quote && "closed. Trying to write more information to this file will erase its contents." with "OK"
EnableMenu 1, 10, false
end if
end closeDiskFile
on compactTheStack
answer return & "About to compact the stack:" with "Cancel" or "Proceed"
if it is "Proceed" then
put msg into temp
put "Compacting the stack..."
doMenu "Compact Stack"
put temp
hide msg
else
exit compactTheStack
end if
end compactTheStack
on convertJournal
global JA
if char 1 of JA is "J" then
if char 1 of JA is "J" and char 2 of JA is "E" and char 3 of JA is "P" then
if char 4 of JA is "," then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology" before JA
else if char 4 of JA is ":" and char 7 of JA is "L" then
put "" into char 9 of JA
put "" into char 8 of JA
put "" into char 7 of JA
put "" into char 6 of JA
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology: Learning, Memory and Cognition" before JA
else if char 4 of JA is ":" and char 7 of JA is "G" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology" before JA
else if char 4 of JA is ":" and char 8 of JA is "L" then
put "" into char 9 of JA
put "" into char 8 of JA
put "" into char 7 of JA
put "" into char 6 of JA
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology: Human Learning and Memory" before JA
else if char 4 of JA is ":" and char 8 of JA is "P" then
put "" into char 9 of JA
put "" into char 8 of JA
put "" into char 7 of JA
put "" into char 6 of JA
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology: Human Perception and Performance" before JA
else if char 4 of JA is ":" and char 7 of JA is "M" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Experimental Psychology" before JA
end if
else if char 1 of JA is "J" and char 2 of JA is "M" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Memory and Language" before JA
else if char 1 of JA is "J" and char 2 of JA is "V" then
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of Verbal Learning and Verbal Behavior" before JA
else if char 1 of JA is "J" and char 2 of JA is "A" and char 3 of JA is "S" and char 4 of JA is "A" then
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Journal of the Acoustical Society of America" before JA
end if
else if char 1 of JA is "M" and char 2 of JA is "&" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Memory and Cognition" before JA
else if char 1 of JA is "P" then
if char 2 of JA is "&" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Perception and Psychophysics" before JA
else if char 7 of JA is "R" then
put "" into char 9 of JA
put "" into char 8 of JA
put "" into char 7 of JA
put "" into char 6 of JA
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Psychological Review" before JA
else if char 7 of JA is "B" then
put "" into char 10 of JA
put "" into char 9 of JA
put "" into char 8 of JA
put "" into char 7 of JA
put "" into char 6 of JA
put "" into char 5 of JA
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Psychological Bulletin" before JA
else if char 2 of JA is "S" and char 3 of JA is "," then
put "" into char 2 of JA
put "" into char 1 of JA
put "Psychological Science" before JA
end if
else if char 1 of JA is "A" and char 2 of JA is "J" and char 3 of JA is "P" then
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "American Journal of Psychology" before JA
else if char 1 of JA is "A" and char 2 of JA is "P" and char 3 of JA is "," then
put "" into char 2 of JA
put "" into char 1 of JA
put "American Psychologist" before JA
else
if char 1 of JA is "Q" and char 2 of JA is "J" then
put "" into char 4 of JA
put "" into char 3 of JA
put "" into char 2 of JA
put "" into char 1 of JA
put "Quarterly Journal of Experimental Psychology" before JA
end if
end if
end convertJournal
on DoBack
global PriorCard
if PriorCard is empty or the name of this cd is "Help Card" or PriorCard is "Help Card" then
exit DoBack
else
set cursor to Signal
visual effect dissolve
go to PriorCard
end if
end DoBack
on DoDeDup
answer "Eliminate Duplicates:" & return & "Is the stack sorted by ΓÇÿAuthorΓÇÖ?" with "Cancel" or "No" or "Yes"
if it is "Cancel" then
exit DoDeDup
else if it is "No" then
answer return & "Sort cards alphabetically by ΓÇÿAuthorΓÇÖ and then Eliminate Duplicates?" with "Cancel" or "Proceed"
if it is not "Cancel" then
sort by field "Author" & field "Title"
else
exit DoDeDup
end if
end if
global NewC, OldC, NewT, OldT, NewA, OldA
put msg into temp
put "Searching for possible duplicates... (Command-Period to terminate)"
put the number of cds of bkgnd id 30235 into numofcards
add -2 to numofcards
put 2 into OldC
put 3 into NewC
put word 1 of bkgnd field "Author" of cd OldC into OldA
put word 2 of bkgnd field "Author" of cd OldC after OldA
put word 5 of bkgnd field "Author" of cd OldC after OldA
put word 1 of bkgnd field "Title" of cd OldC into OldT
put word 4 of bkgnd field "Title" of cd OldC after OldT
put last word of bkgnd field "Title" of cd OldC after OldT
repeat forever
set cursor to busy
put word 1 of bkgnd field "Author" of cd NewC into NewA
put word 2 of bkgnd field "Author" of cd NewC after NewA
put word 5 of bkgnd field "Author" of cd NewC after NewA
put word 1 of bkgnd field "Title" of cd NewC into NewT
put word 4 of bkgnd field "Title" of cd NewC after NewT
put last word of bkgnd field "Title" of cd NewC after NewT
if NewA = OldA and NewT = OldT then
beep
go to cd OldC
answer return & "This and the next card may be duplicates" with "Show Next"
go to cd NewC
answer return & "Delete which card?" with "1st" or "2nd" or "Neither"
if it is "1st" then
go prev
DoDeleteThisCard
else if it is "2nd" then
DoDeleteThisCard
end if
put msg
end if
put NewC into OldC
put NewA into OldA
put NewT into OldT
add 1 to NewC
if NewC > numofcards then exit repeat
end repeat
put temp
hide msg
beep
answer return & "End of de-duplicating." with "Ok"
end DoDeDup
on DoDeleteThisCard
answer return & "About to delete this card and erase all of the information permanently:" with "Proceed" or "Cancel"
if it is "Proceed" then
set cursor to 4
domenu "Delete Card"
put the number of cds of bkgnd id 30235 into cd field "number of cards" of cd "Help Card"
end if
end DoDeleteThisCard
on DoMakeNewCard
set cursor to 4
doMenu "New Card"
put "New" into bkgnd field "Status"
get the short date
put it into bkgnd field id 82
put the number of cds of bkgnd id 30235 into cd field "number of cards" of cd "Help Card"
put "?" into bkgnd field id 73
end DoMakeNewCard
on FindIt
set cursor to RegFind
set lockscreen to true
global toBeFound,howToSearch,whereToSearch,PriorCard
put the name of this cd into tempPriorCard
if toBeFound is empty then
EnableMenu 1, 3, false
else
EnableMenu 1, 3, true
end if
if whereToSearch is "All" and howToSearch is empty then
put "Find" && quote & toBeFound & quote
else if whereToSearch is "All" and howToSearch is "whole" then
put "Find whole" && quote & toBeFound & quote
else if howToSearch is empty and whereToSearch is not "All" then
put "Find" && quote & toBeFound & quote && "in field" && whereToSearch
else if howToSearch is "whole" and whereToSearch is not "All" then
put "Find whole" && quote & toBeFound & quote && "in field" && whereToSearch
end if
hide msg
type return
if the short name of this cd is "Help Card" then
go next cd
type return
end if
if the result is not empty then
put toBeFound into bkgnd field id 80
set lockScreen to false
if whereToSearch is "All" then
answer return & "There are no occurrences of ΓÇÿ" & toBeFound & "ΓÇÖ in any field." with "Ok"
else
answer return & "There are no occurrences of ΓÇÿ" & toBeFound & "ΓÇÖ in the ΓÇÿ" & whereToSearch & "ΓÇÖ field." with "Ok"
end if
EnableMenu 1, 3, false
else
put toBeFound into bkgnd field id 80
set lockScreen to false
global beenThere
put the number of this cd into beenThere
put tempPriorCard into PriorCard
end if
end FindIt
on helpButton message,msgloc
global screensize
put msg into temp
set cursor to Help
if msgloc is not empty and screensize is "Small" then
set loc of msg to 22,220
end if
put message
repeat while the shiftKey is down
end repeat
put temp
hide msg
if screensize is "Small" then set loc of msg to 22,300
end helpButton
on PreliminaryWriteOut
answer return & "Write out articles based on ΓÇÿstatusΓÇÖ or ΓÇÿdateΓÇÖ?" with "Cancel" or "Date" or "Status"
if it is "Cancel" then
exit PreliminaryWriteOut
else if it is "Status" then
writeOutNewArticles
else
answer return & "Is the stack sorted by date ?" with "No" or "Yes"
if it is "No" then
answer return & "The stack must be sorted by date for this procedure to work." with "Ok"
exit PreliminaryWriteOut
else
writeOutByDate
end if
end if
end PreliminaryWriteOut
on quickFind
set cursor to quickFind
hide msg
set lockscreen to true
global toBeFound,howToSearch,whereToSearch,PriorCard,beenThere
if toBeFound is empty then
EnableMenu 1, 3, false
else
EnableMenu 1, 3, true
end if
set the name of bkgnd button id 79 to whereToSearch
put the name of this cd into tempPriorCard
put the number of this cd into beenThere
go next cd of this bkgnd
put empty into bkgnd field id 80
if howToSearch is "whole" then
put "Find whole" && quote & toBeFound & quote && "in field" && whereToSearch
else
put "Find" && quote & toBeFound & quote && "in field" && whereToSearch
end if
hide msg
put bkgnd field id 80 into tempToBeFound
put empty into bkgnd field id 80
type return
if the short name of this cd is "Help Card" then
go next cd
type return
end if
if the result is not empty or the number of this cd is beenThere then
put tempToBeFound into bkgnd field id 80
go to tempPriorCard
set lockScreen to false
beep
answer "There are no more occurrences of ΓÇÿ" & toBeFound & "ΓÇÖ in the field ΓÇÿ" & whereToSearch & "ΓÇÖ." with "Ok"
EnableMenu 1, 3, false
else
put ToBeFound into bkgnd field id 80
set lockScreen to false
put tempPriorCard into PriorCard
end if
end quickFind
on readInNewArticles
put the number of cds of bkgnd id 30235 into numofcards
put "TEXT" into type
get Filename(type)
if it is empty then
exit readInNewArticles
else
put it into upf
end if
open file upf
repeat forever
read from file upf until return
if it is not empty then
put it into temp
DoMakeNewCard
add 1 to numofcards
put temp into field "Author"
read from file upf until return
put it into field "Title"
read from file upf until return
put it into field "Source"
read from file upf until return
put it into field "Comments"
read from file upf until return
put it into field "Keywords"
put "?" into bkgnd field "Possession"
else
exit repeat
end if
end repeat
close file upf
put "Last Update: " & the short date into cd field "LastUpdated" of cd "Help Card"
answer return & "All new information read in." with "Ok"
end readInNewArticles
on screenCheck
global screenSize
if screenSize is "small" then
hide menuBar
end if
end screenCheck
on sortIt
answer return & "Sort cards by ΓÇÿAuthorΓÇÖ or by ΓÇÿDateMadeΓÇÖ ?" with "Other" or "DateMade" or "Author"
if it is "DateMade" then
put msg into temp
put "Sorting by ΓÇÿDateMadeΓÇÖ..."
sort descending datetime by field "DateMade"
put temp
hide msg
exit sortIt
else if it is "Author" then
put msg into temp
put "Sorting by ΓÇÿAuthorΓÇÖ..."
sort by field "Author" & field "Title"
put temp
hide msg
exit sortIt
else if it is "Other" then
answer return & "Sort cards by ΓÇÿSourceΓÇÖ or by ΓÇÿStatusΓÇÖ ?" with "Cancel" or "Source" or "Status"
if it is "Source" then
put msg into temp
put "Sorting by ΓÇÿSourceΓÇÖ..."
sort by field "Source"
put temp
hide msg
exit sortIt
else if it is "Status" then
put msg into temp
put "Sorting by ΓÇÿStatusΓÇÖ..."
sort by field "Status"
put temp
hide msg
exit sortIt
end if
end if
end sortIt
on writeClipOut
set cursor to 4
put "Heap oΓÇÖ Clippings" into shortFile
put NewFileName( "Save file as:",(shortFile)) into fn
if fn is empty or char 1 of fn is "ΓÇö" then exit writeClipOut
set cursor to 4
if fn is not empty then
put cd field "HoldingArea" of cd "Help Card" into temp
if temp is empty then
answer return & "Cancelled: There is nothing in the special clipboard."
else
open file fn
write temp to file fn
close file fn
clearClip
answer "Special clipboard written to file ΓÇ£" & fn & "ΓÇ¥ and special clipboard cleared."
end if
end if
end writeClipOut
on writeOutByDate
set cursor to 4
put "Date Update From" into shortFile
put NewFileName( "Save file as:",(shortFile)) into upf
if upf is empty or char 1 of upf is "ΓÇö" then exit writeOutByDate
put the short date into temp
ask "Enter last date to be included:" with temp
if it is empty then
exit writeOutByDate
else
put it into CutOff
end if
go to cd 2
open file upf
convert CutOff to dateItems
repeat forever
set cursor to busy
put field "DateMade" into temp
convert temp to dateItems
if item 1 of temp >= item 1 of Cutoff and item 2 of temp >= item 2 of Cutoff and item 3 of temp >= item 3 of Cutoff then
write first line of field "Author" & return to file upf
write first line of field "Title" & return to file upf
write first line of field "Source" & return to file upf
write first line of field "Comments" & return to file upf
write first line of field "Keywords" & return to file upf
go next cd of this bkgnd
else
exit repeat
end if
end repeat
close file upf
convert CutOff to short date
answer return & "All articles entered on or after" && CutOff && "have been written to the file" && "ΓÇ£" & upf & "ΓÇ¥." with "Ok"
end writeOutByDate
on writeOutNewArticles
set cursor to 4
put the number of cds of bkgnd id 30235 into numofcards
put "Status Update From" into shortFile
put NewFileName( "Save file as:",(shortFile)) into upf
if upf is empty or char 1 of upf is "ΓÇö" then exit writeOutNewArticles
open file upf
set cursor to busy
put "Find" && quote & "New" & quote && "in field" && quote & "Status" & quote
hide msg
repeat forever
type return
if the result is not empty then
answer return & "All new articles have been written to the file" && "ΓÇ£" & upf & "ΓÇ¥." with "Ok"
close file upf
exit repeat
else
put "?" into bkgnd field "Status"
write first line of field "Author" & return to file upf
write first line of field "Title" & return to file upf
write first line of field "Source" & return to file upf
write first line of field "Comments" & return to file upf
write first line of field "Keywords" & return to file upf